﻿namespace assignment5
{
    internal class Program
    {
        static void Main(string[] args)
        {
            OrderService service;

            Order order = new Order(6,"Jack");
            
            List<(int,int,string)> values = new List<(int, int, string)> { (20, 5, "牛奶")};
            OrderDetails details=new OrderDetails(order,DateTime.Now,values);
            
            service = new OrderService(details);
            bool flag=false;
            while(!flag)
            {
                Console.WriteLine("订单管理程序：");
                Console.WriteLine("目前可实现几个功能，包括：\n1.添加订单\n2.删除订单\n3.修改订单\n4.查询订单\n5.退出");
                string str = Console.ReadLine();
                if (int.TryParse(str, out int number))
                {
                    int op=number;
                    switch (op)
                    {
                        case 1:
                            service.AddOder();
                            break;
                        case 2:
                            Console.WriteLine("输入要删除的订单号：");
                            string num1=Console.ReadLine();
                            if (int.TryParse(num1, out int x))
                            {
                                service.Deloder(x);
                            }
                            else Console.WriteLine("输入的订单号不是整数类型");
                            break;
                        case 3:
                            Console.WriteLine("输入要修改的订单号：");
                            string num2 = Console.ReadLine();
                            if (int.TryParse(num2, out int y))
                            {
                                service.Reoder(y);
                            }
                            else Console.WriteLine("输入的订单号不是整数类型");
                            break;
                        case 4:
                            Console.WriteLine("输入要查询的订单号：");
                            string num3 = Console.ReadLine();
                            if (int.TryParse(num3, out int z))
                            {
                                service.Reserch(z);
                            }
                            else Console.WriteLine("输入的订单号不是整数类型");
                            break;
                        case 5:
                            service.Sortoder();
                            
                            break;
                        case 6:
                            flag = true;
                            break;
                        default:
                            Console.WriteLine("无对应操作");
                            break;
                    }
                }
                else
                {
                    Console.WriteLine("输入无效，无对应操作！");
                }
            }
            
        }
    }
}
